package week7.kaarten;
import java.util.*;
import week7.util.*;

/**
 * 
 * Practicumopgave Programmeren 1
 * @author Rick Clement en Adriaan Dekker
 * @version $Revision: 1.3 $
 */
public class Hand extends SortedList<Kaart> {
    // ------------------ Aanvragen --------------------------

	public String toString() {
		String result1 = "  ";
		String result2 = "  ";
		String result3 = "  ";
		
		char[] uppercard = {(char)218, (char)205, (char)205, (char)191};
		char[] lowercard = {(char)192, (char)205, (char)205, (char)217};
		char[] sidecard  = {(char)186};
		
		for (int i = 0; i < size(); i++) {
			result1 += new String(uppercard);
			result2 += new String(sidecard) + get(i) + new String(sidecard);
			result3 += new String(lowercard);
		}

		// vervang harten
		char[] array = {(char)3};
		result2 = result2.replace("Harten ", new String(array));
		// vervang ruiten
		array = new char[] {(char)4};
		result2 = result2.replace("Ruiten ", new String(array));
		// vervang klaveren
		array = new char[] {(char)5};
		result2 = result2.replace("Klaveren ", new String(array));
		// vervang schoppen
		array = new char[] {(char)6};
		result2 = result2.replace("Schoppen ", new String(array));
		// vervang heer
		result2 = result2.replace("heer", "H");
		// vervang vrouw
		result2 = result2.replace("vrouw", "V");
		// vervang boer
		result2 = result2.replace("boer", "B");
		// vervang aas
		result2 = result2.replace("aas", "A");
		// vervang de 10
		result2 = result2.replace("10", "T");
	
		return result1 + "\n" + result2 + "\n" + result3;
	}
   
    // ------------------ Commando's --------------------------

    public boolean lessThan(Kaart kaart1, Kaart kaart2) {
		if(kaart1.kdRang(kaart2) && kaart1.kdKleur(kaart2)) {
			return true;
		} else if(kaart1.getKleur() == kaart2.getKleur() && kaart1.kdRang(kaart2)) {
			return true;
		} else return false;
	}
}
